<?
	include_once("codelibrary/inc/variables.php");//Using variables.php for Database Connectivity
	include_once("session.php");
	include_once("codelibrary/inc/functions.php");//Using functions.php for using getAnyTableWhereData()
	$array_str="";
	foreach($arr_allowed_extensions as $temp)
	{
		$array_str.="'".$temp."',";	//creating  array of valid extentions of Image1 from the array stored in   variables.php
	}
	$array_str=substr($array_str,0,(strlen($array_str)-1));


?>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>UPLMS - Complete Pipeline Management System</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META http-equiv=Content-Language content=en-us>
<META content="" name=title>
<META content="" name=keywords>
<META content="" name=description>
<META content="index, follow" name=robots>
<META content="3 days" name=revisit>
<META content="" name=document-classification>
<META content=Global name=document-distribution>
<LINK href="uplms-images/styles.css" type=text/css rel=stylesheet>
<META content="MSHTML 7.00.5112.0" name=GENERATOR>
<script language="JavaScript1.2" src="codelibrary/js/common.Js"></script>
<script language="JavaScript1.2" src="codelibrary/js/cal_change.js"></script>
<script type="text/javascript" src="calendarDateInput.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="winxp.css" title="winxp">
<link href="codelibrary/css/standard_user_classes.css" rel="stylesheet" type="text/css">
<link href="cal.css" rel="stylesheet" type="text/css">
<link href="template.css" rel="stylesheet" type="text/css">
<script>
	function submitform()
	{
		if(chkimage(document.BackfillingDetails.Scanned_Document) && ValidateForm(document.BackfillingDetails))
		{
			return true;
		}
		else
		{
			return false;
		}
	}

	function notyping(obj)
	{
			alert("You are not allowed to type please choose by clicking Browse");
			obj.blur();
			return;
	}
	
	var imgname;
	function chkimage(imgname)
	{
		//function to check wether the uploaded Image is valid or not								
		image_name=imgname;
		iscorrect="no"; 
		if(image_name.value!="")
		{
			x = Array(<?=$array_str;?>);
			for (var i = 0;i<x.length;i++)
			{											
				// validation of right type of Image1,checking from array defined in variables.php
				if(image_name.value.substring(image_name.value.lastIndexOf('.')+1).toLowerCase()==x[i]) 
				{
						iscorrect="yes";
				}
			}
			//alert(iscorrect);
			if(image_name.value.indexOf("'")!=-1)
			{
				alert ("You cannot upload File having single quotes (') in its name");
				return false;
			}
			else if(iscorrect=="no")
			{
				alert ("File can only be of type:-"+x);	// validation of right type of image_name_obj     checking from array defined in variables.php
				image_name.select();
				return false;
			}
			else 
			{
				return true;
			}
		 }
		else
		{
			return true;
		}
	}
</script>
</HEAD>
<BODY>
<TABLE class=mainBox id=mainBox height="100%" cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
    <TR bgColor=#ffffff>
      <TD height=100 vAlign=center background="uplms-images/TopHeader.jpg" bgColor=#3e5a90>&nbsp; </TD>
    </TR>
    <TR >
      <TD height=1 vAlign=top>
        <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
            <TR>
               <TD width="33%" height="25" class="MenuTop" > 
                </TD>
              <TD width="40%" class="MenuTop">Login Date & Time : <span class="productPriceTXT">
                <?=date("d-m-Y H:i:s");?>
              </span> </TD>
              <TD width="27%" class="MenuTop"><div align="right"><span class="productPriceTXT"><?echo $sess_user_name;?></span> Logged In | <span class="productPriceTXT style6"><a href='logout.php?ID=<?=$Trail_ID?>'>LOGOUT</a></span> </div></TD>
            </TR>
          
      </TABLE></TD>
    </TR>
    <TR class="MenuTop" bgColor="#ffffff">
      <TD height=33 vAlign=center background="uplms-images/1.gif" bgcolor="#FF9900" class=MenuTop>
         <DIV align=left> <a href="javascript:history.go(-1);"><b>Back</b></a>
            <script type="text/javascript" src="milonic_src.js"></script>
            <script	type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");		
  else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>"); 
      </script>
            <? include "menu_data.php"; ?>
      </DIV></TD>
    </TR>
	 <TR>
    <TD id="main" vAlign="top" width="100%" height="100%">
      <TABLE width="100%" border="0" cellPadding="0" cellSpacing="0" id="main1">
		<br>
		<?
		if(isset($special) && $special=='Open')
		{
			?>
			<tr>
				<td style="padding-left:10px; padding-right:10px" class="lnkblue">
					Open Cut Backfilling 
				</td>
			</tr>		
			<?
		}
		else
		{
			?>
			<tr>
				<td style="padding-left:10px; padding-right:10px" class="lnkblue">
					Activity - Backfilling 
				</td>
			</tr>		
			<?
		}
		?>				
        <TR vAlign=top>
          <TD style="padding-left:10px; padding-right:10px">             
			<HR>
			<!--
            <div align="left"><a href="StartPage.php">Home</a> 
                      <?
					  if(isset($special))
					  {
					  	switch($special)
						{
							case 'HDD':
									?>
									&gt;&gt;<a href='HDD-Backfilling-View-Details.php'>Manage HDD Backfilling </a>&gt;&gt;Edit HDD Backfilling Details</div>
									<? 
									break;
							case 'Open':
									?>
									&gt;&gt;<a href='OpenCut-Backfilling-View-Details.php'>Manage Open Cut Backfilling </a>&gt;&gt;Edit Open Cut Backfilling Details</div>
									<? 
									break;
							default:
									?>
									&gt;&gt;<a href='Backfilling-View-Details.php'>Manage Backfilling </a>&gt;&gt;Edit Backfilling Details</div>
									<?  
						}
					  }
					  ?>
            <HR>-->
            <br>
			
			<form name="BackfillingDetails" method="post" action="edit_backfilling_submit.php?id=<?=$id;?><? if(isset($special) && $special=='Open'){?>&special=Open <?}?><?if(isset($special) && $special=='HDD'){?>&special=HDD <?}?>" onSubmit="return submitform();" enctype="multipart/form-data">
			<?
			       $getData=getAnyTableWhereData($backfilling_details_table," and BackfillingID='$id'");
				   $BackfillingDate=$getData['BackfillingDate'];
			  ?>
            <table width="501" border="0" align="center" class="">
			<tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
			    <td height="30" class="MenuTop">Report Number</td>
                <td height="30"><input name="TR_Report_Number" type="text" value="<?=$getData["BackfillingReptNo"];?>" size="25"></td>
              </tr>
			<?
			if(isset($special) && $special=='Open')
			{
			?>
			<tr class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
				<td height="30" class="MenuTop">Crossing Number</td>
				<td height="30">
					<?
					$SqlCrossing = "Select * from Crossing where Section='$User_Section'";
					$DataSqlCrossing = mysql_query($SqlCrossing);
					$SqlCrossingID = "Select * from Crossing where CrossingID='".$getData['CrossingID']."'";
					$DataSqlCrossingID = mysql_query($SqlCrossingID);
					$RowDataSqlCrossingID = mysql_fetch_array($DataSqlCrossingID);					
					?>
					<select name="TR_Crossing" class="txt">
						<option value="">--Select Crossing--</option>
						<?
						while($RowDataSqlCrossing = mysql_fetch_array($DataSqlCrossing))
						{
							?>
							<option value="<?=$RowDataSqlCrossing['CrossingID']?>" <?if($getData["CrossingID"]==$RowDataSqlCrossingID['CrossingID']){?>Selected<? }?>><?=$RowDataSqlCrossing['CrossingNumber']?></option>
							<? 
						}
						?>
					</select>
				</td>
			</tr>
			<?
			}
			?>
			<tr valign="top" class="<?echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
                <td height="26" class="MenuTop">Backfilling  Date</td>
                <td height="26"><script>DateInput('Backfilling_Date', true, 'YYYY-MM-DD','<?=$BackfillingDate?>')</script>				</td>
                </tr>
			  <!-- <tr align="left" valign="top"> 
				   <td height="30" class="MenuTop">Pipe Number</td>
				   <td height="30"><select name="TR_Pipe_Number">
				   <option value="">--Select Pipe Number--</option>
				   <?
						$res_pipe=mysql_query("select * from $pipe_store_table where Status=$GL_active order by PipeNumber");
						while($row_pipe=mysql_fetch_array($res_pipe))
						{
							$PipeNumber=$row_pipe["PipeNumber"];
							$PipeID=$row_welder["PipeID"];
                            echo "<option value=$PipeNumber";
							if($getData["PipeNumber"]==$PipeNumber)
							{		
										echo " selected";
							}
							echo ">".$PipeNumber."</option>";
						}
					?>
					</select>
					</td>
			  </tr> -->
			 <tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
				   <td height="30" class="MenuTop">Weld Joint Number From</td>
				   <td height="30">
				   <select name="TN_WeldJointNo_From">
				   <option value="">--Select One--</option>
				   <? 
						 
						 $res_weld=mysql_query("select * from $welding_history_table where Section='".$User_Section."' and Spread='".$User_Spread."' and Status=$GL_active order by WeldNumber, Seq");
						while($row_weld=mysql_fetch_array($res_weld))
						{
							$WeldNumber=$row_weld["WeldNumber"];
							$WeldID=$row_weld["WeldID"];
                            echo "<option value=$WeldNumber";
							
							if($getData["JointFrom"]==$WeldNumber)
							{		
								echo " selected";
							}
							echo ">".$WeldNumber."</option>";
						}
					?>
					</select>
					</td>
			  </tr>
			 <tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
				   <td height="30" class="MenuTop">Weld Joint Number To</td>
				   <td height="30">
				   <select name="TN_WeldJointNo_To">
				   <option value="">--Select One--</option>
				   <?
						$res_weld=mysql_query("select * from $welding_history_table where Section='".$User_Section."' and Spread='".$User_Spread."' and Status=$GL_active order by WeldNumber, Seq");
						while($row_weld=mysql_fetch_array($res_weld))
						{
							$WeldNumber=$row_weld["WeldNumber"];
							$WeldID=$row_weld["WeldID"];
                            echo "<option value=$WeldNumber";
							if($getData["JointTo"]==$WeldNumber)
							{		
								echo " selected";
							}
							echo ">".$WeldNumber."</option>";
						}
					?>
					</select>
					</td>
			  </tr>
			 <tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
			    <td height="30" class="MenuTop">Chainage From</td>
                <td height="30"><input name="TN_Chainage_From" type="text" value="<?=$getData["ChainageFrom"];?>" size="25">
                meter</td>
              </tr>
			  <tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
			    <td height="30" class="MenuTop">Chainage To</td>
                <td height="30"><input name="TN_Chainage_To" type="text" value="<?=$getData["ChainageTo"];?>" size="25">
                meter</td>
              </tr>
			 <tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
			    <td height="30" class="MenuTop">Pipe Top Level</td>
                <td height="30"><input name="MN_PipeTopLevel" type="text" value="<?=$getData["PipeTopLevel"];?>" size="25"> meter</td>
              </tr>
			 <tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
			    <td height="30" class="MenuTop">Natural Ground Level</td>
                <td height="30"><input name="MN_NaturalGroundLevel" type="text" value="<?=$getData["NaturalGroundLevel"];?>" size="25"> meter</td>
              </tr>
			<tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
                <td height="30" class="MenuTop" valign="top">Remarks</td>
                <td height="30"><textarea name="TN_Remarks" cols="25" rows="4"><?=$getData['Remarks'];?></textarea></td>
              </tr>
			  <tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
                <td height="30" class="MenuTop">Scanned Form</td>
                <td height="30">
				<?
				if($getData["ScannedForm"]!="")
				{
					if(isset($special) && $special=='Open')
					{
						$file_name=$OpenCutBackfilling_Folder.$getData["BackfillingReptNo"]."_"."OpenCutBackfilling"."_".$getData["ScannedForm"];
					}
					else
					{
						 $file_name=$backfilling_folder.$getData["BackfillingReptNo"]."_"."Backfilling"."_".$getData["ScannedForm"];	
					}
					?>
					<a href="<? echo $file_name;?>" target="_blank" class="alink"><?=$getData['ScannedForm'];?><br></a>
					<?
				}
				?>
				<input type="file" name="Scanned_Document" size="25" onKeyPress="notyping(this)"></td>
              </tr>
			  
			 <tr valign="top" class="<? echo alternate_row(++$tdrow,$frmtdClass1,$frmtdClass2)?>">
                <td colspan="2" height="30" class="MenuTop" align="center">
				<input type="submit" name="edit" value=" Edit ">&nbsp;
				<input type="reset" name="reset" value=" Reset ">
				</td>
              </tr>
            </table>
			</form>
            <p>&nbsp;</p>
            <P style="MARGIN-TOP: 0px" align=center>&nbsp;</P></TD>
          <TD vAlign="top" bgColor="#ffffff" class="col3"><div align="center">&nbsp;</div></TD>
        </TR></TABLE></TD></TR>
  <TR>
    <TD height=1>

      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TR>
          <TD bgColor=#3e5a90 height=25>&nbsp;</TD>
        </TR></TABLE></TD></TR>
  <TR bgColor=#ffffff>
    <TD vAlign=center align=middle bgColor=#ffffff height=30>
      <DIV class="Heading style2" align=center>
      <DIV align=center><A href="index.html">Home</A> <IMG 
      height=18 src="uplms-images/Separator.gif" width=13 align="absMiddle">Profile<IMG height=18 
      src="uplms-images/Separator.gif" width=13 align="absMiddle">Contact Us<BR>
        </DIV>
      </DIV></TD></TR></TABLE>